package com.iss.service.file;

import com.iss.model.Order;
import com.iss.model.Room;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class RoomToFile {

    private static String directory = "F:\\workplace2021\\hotel\\src\\rooms";
    private static String FILE_ROOMS_JSON=
            "F:\\workplace2021\\hotel\\src\\rooms\\room_status.json";


    public void createFileForRoom(Room room) {

        File file = new File(directory + File.separator + room.getRoomNO());
        file.mkdirs();

    }


    public void addOrderToRoom(Order order){

        try {
            FileReader fileReader = new FileReader(RoomToFile.FILE_ROOMS_JSON);
            String json="";
           fileReader.read();


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        File file = new File(directory + File.separator
                + order.getRoom().getRoomNO()+File.separator+order.getOderNO());

        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
